<%@ page import="com.bjpowernode.javaweb.jsp.bean.User" %>
<%@ page import="com.bjpowernode.javaweb.jsp.bean.Address" %>
<%@page contentType="text/html;charset=utf-8" %>

<%
    //创建User对象
    User user=new User();
    user.setUsername("jack");
    user.setPassword("123");
    user.setAge(50);

    Address address=new Address();
    address.setCity("北京");
    address.setStreet("大兴区");
    address.setZipcode("10010");

    user.setAddress(address);

    request.setAttribute("userObj",user);
%>

<%-- 使用el表达式，取出User对象--%>
${userObj}<br/>

<%--输出User的属性--%>
${userObj.username}<br/>
${userObj.password}<br/>
${userObj.age}<br/>
${userObj.email}<br/>

<%-- 取出user对象是哪个城市的--%>
${userObj.address22.city}<br/>
${userObj.address22.street}<br/>
${userObj.address22.zipcode}<br/>